package com.artnology.independence.model.relationships;

import java.awt.BasicStroke;
import java.awt.Stroke;

import com.artnology.independence.Activator;
import com.artnology.independence.model.DVGraphModel;
import com.artnology.independence.model.DVType;
import com.artnology.independence.views.DependencyView;

public class DVUsesRelationship extends DVAbstractTypeRelationship {

	public DVUsesRelationship(DVGraphModel model, DVType referencedNode, DVType referenceFromType) {
		super(null, model, referencedNode, referenceFromType);
	}

	@Override
	public String getPrefix() {
		return weight + " * \"Usage\"";
	}
	
	@Override
	public String getLabel() {
		if (Activator.getDefault().getPrefStore().getBoolean(DependencyView.SHOW_RELATIONSHIP_NAMES)) {
			return getPrefix();
		} else{
			return "";
		}
	}



	@Override
	public Stroke getStroke() {
		if (Activator.getDefault().getPrefStore().getBoolean(DependencyView.INDICATE_CROSS_PACKAGE_EDGE) && this.crossesPackageBorder()) {
			return new BasicStroke(3f,
					BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f,
					new float[] { 2.0f }, 5.0f);
		}
		return new BasicStroke(0.2f * weight,
				BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f,
				new float[] { 2.0f }, 5.0f);
	}


}
